import { useEffect, useState } from "react";

export const mockRequest = () => {
  const data: any[] = []
  return new Promise((resolve) => {
    setTimeout(() => {
      for (let i = 0; i < 3; i++) {
        data.push({
          id: i.toString(),
        })
      }
      resolve(data)
    }, 1000)
  })
}

function Home() {
  const statusOptions = [{
    value: 'active',
    label: 'active',
  }, {
    value: 'down',
    label: 'down',
  }]
  const [searchOptionsParams, setSearchOptionsParams] = useState({
    'status': statusOptions
  })


  const initData = async () => {
    const res = await mockRequest()
    let newPrams = { ...searchOptionsParams, owners: res }
    setSearchOptionsParams(newPrams)
  }

  console.log(searchOptionsParams)

  useEffect(() => {
    initData()
  }, [])

  return (
    <div>
      Home
    </div>
  )
}
export default Home